All Questions
Tagged with text-processingtext-formatting
179 questions
1vote
2answers
178views
Extracting table of contents from PDFs
I have a reasonably large personal library with books in various formats. I have tried to organize their metadata, including a text field containing the tables of contents. At the moment I am using ...
0votes
4answers
165views
Aligning space separated words in columns
There is a text file, file.txt. In there is: abc 01245 def-1 32154 ghi-3 55432 jkl 44121 mno-4 23147 pqr 897044 .... How to format this to an output like this: abc 01245 def-1 32154 ghi-3 55432 jkl ...
1vote
2answers
165views
Reformat text to exact width [duplicate]
On Ubuntu, how to reformat text to fit width (except final line), adding spaces where necessary? The closest I can get is with fmt --width=64, but this does not add the spaces between words. Input ...
0votes
0answers
147views
Find and replace in CudaText editor
So I have dump from U-boot and I need to replace specific string in CudaText editor. Here is mine text e101b1e0: 30ef27d8 e792f415 9beea618 5c601de4 .'.0..........`\ e101b1f0: aeaf9d25 e1dd63e9 ...
3votes
5answers
756views
How can I reformat blocks of data until the end of the file is reached?
I have a file that looks like this: # Time-averaged data for fix avetimeall # TimeStep Number-of-rows # Row c_gyrationchunkall 1000 3 1 2.09024e-14 2 4.88628 3 5.69321 2000 3 1 2.10518e-14 2 8.33702 3 ...
1vote
5answers
146views
Add two delimiters after every sixth comma
I'm trying to expand on this question but can't figure out this issue: Let's say I've got a file roll.txt: echo "'123456789','987651234','129873645','213456789','987612345','543216789','432156789'...
-2votes
2answers
60views
How to group matching data from first two column [closed]
I would like to group data from first two fields as per below Sample Data: CHECK|checkadm|block1 CHECK|checkadm|block2 CHECK|checkadm|block3 CHECK|checkadm|block4 TEST|testadm|block1 TEST|testadm|...
0votes
2answers
220views
How to echo a string inside a category in a ini file with quotes
I have an ini file like for example [Admin Prefixes] # Here you can add custom prefixes to specific players or flags that are shown when using $admin_prefix$. # Syntax: "type" "info&...
0votes
2answers
406views
convert xterm256 to ansi
I have a program that will only accept ANSI color input but I have reason to feed it the output of a program that outputs xterm256 color codes. Is there a converter? I realize of course that color ...
1vote
3answers
288views
text processing rows to columns for a block of lines Awk
i have input file like below .i need to reformat the text as o/p mentioned. I using the awk got from this forum but it is displayed based on the List A columns count. Please help awk 'BEGIN{ max=0 } ...
3votes
6answers
1kviews
Splitting columns in TSV into CSV
I have a TSV file with two columns in the format of id1\tcol1,col2,col3 id2\tcol4,col5 I want to split the second column in combination with the first column to output id1,col1 id1,col2 id1,col3 id2,...
3votes
2answers
255views
Indent lines of text following given rule
I was wondering how indenting recursively more and more lines of poetry following a custom rule. For instance Let say we have: OF Mans First Disobedience, and the Fruit Of that Forbidden Tree, whose ...
1vote
4answers
570views
Split the line into next line after a matching pattern
In the input file shown below, I am trying to find the string job_type and move the it to the next line if it matches job_type. I tried this, but it is not working: sed "s/[A-Z][a-z]*job_type:/\...
2votes
2answers
623views
awk replace column value with increment values if length equals
I have non-standard data, which I'd like to standardise file: d101 11001 e101 9665 f101 9663 d102 11002 e102 11003 f102 11004 g102 11005 desired output: d101 11001 e101 12001 f101 12002 d102 11002 ...
5votes
5answers
1kviews
If column has multiple values, copy line with each value separately
I have a file with the following format, each column separated by tabs: C1 C2 C3 a b,c d e f,g,h i j k l ... Now I need to have the number of lines according to the number of values ...